package com.zxw.hotel.api;

import com.zxw.hotel.model.Charts;
import com.zxw.hotel.service.ChartsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/api/v1/charts")
public class ChartsApi {
    private ChartsService chartsService;
    @Autowired
    public ChartsApi(ChartsService chartsService) {
        this.chartsService = chartsService;
    }
    @GetMapping
    public Map<String, Object> getCharts() {
        List<Charts> charts1 = chartsService.getCharts();
        return Map.of("success",true,"data", charts1);
    }
}
